package com.inifitness.common.rabbitmq;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;

/**
 * 直接队列
 *
 * @author sunjinfeng
 * @version 1.0.0
 * @since 2023-02-01 17:04
 */
//@Configuration
public class DirectRabbitConfig {

  public static final String DIRECT_QUEUE = "inifitness.direct.queue";
  public static final String DIRECT_EXCHANGE = "inifitness.direct.exchange";
  public static final String DIRECT_ROUTING = "inifitness.direct.key";

  @Bean
  public Queue directQueue() {
    return new Queue(DIRECT_QUEUE, true);
  }

  @Bean
  DirectExchange directExchange() {
    return new DirectExchange(DIRECT_EXCHANGE);
  }

  @Bean
  Binding bindingDirect() {
    return BindingBuilder.bind(directQueue()).to(directExchange()).with(DIRECT_ROUTING);
  }

}

